package com.ruoyi.test_emp.service.impl;

import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.ruoyi.test_emp.domain.TestEmp;
import com.ruoyi.test_emp.mapper.TestEmpMapper;
import com.ruoyi.test_emp.service.ITestDeptService;
import com.ruoyi.test_emp.service.ITestEmpService;
import org.springframework.beans.BeansException;
import org.springframework.beans.factory.*;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.CommandLineRunner;
import org.springframework.stereotype.Service;

import javax.annotation.PostConstruct;
import java.util.List;

/**
 * 员工测试Service业务层处理
 * 
 * @author ruoyi
 * @date 2021-10-03
 */
@Service
public class TestEmpServiceImpl extends ServiceImpl<TestEmpMapper,TestEmp> implements ITestEmpService, BeanFactoryAware,BeanNameAware, InitializingBean,DisposableBean, CommandLineRunner
{
    @Autowired
    private TestEmpMapper testEmpMapper;
    
    private ITestDeptService iTestDeptService;



    /**
     * 查询员工测试
     * 
     * @param id 员工测试ID
     * @return 员工测试
     */
    @Override
    public TestEmp selectTestEmpById(Integer id)
    {
        return testEmpMapper.selectTestEmpById(id);
    }

    /**
     * 查询员工测试列表
     * 
     * @param testEmp 员工测试
     * @return 员工测试
     */
    @Override
    public List<TestEmp> selectTestEmpList(TestEmp testEmp)
    {
        return testEmpMapper.selectTestEmpList(testEmp);
    }

    /**
     * 新增员工测试
     * 
     * @param testEmp 员工测试
     * @return 结果
     */
    @Override
    public int insertTestEmp(TestEmp testEmp)
    {
        return testEmpMapper.insertTestEmp(testEmp);
    }

    /**
     * 修改员工测试
     * 
     * @param testEmp 员工测试
     * @return 结果
     */
    @Override
    public int updateTestEmp(TestEmp testEmp)
    {
        return testEmpMapper.updateTestEmp(testEmp);
    }

    /**
     * 批量删除员工测试
     * 
     * @param ids 需要删除的员工测试ID
     * @return 结果
     */
    @Override
    public int deleteTestEmpByIds(Integer[] ids)
    {
        return testEmpMapper.deleteTestEmpByIds(ids);
    }

    /**
     * 删除员工测试信息
     * 
     * @param id 员工测试ID
     * @return 结果
     */
    @Override
    public int deleteTestEmpById(Integer id)
    {
        return testEmpMapper.deleteTestEmpById(id);
    }

    public TestEmpServiceImpl(){
        System.out.println("TestEmpServiceImpl构造器");
    }

    @Autowired
    public void setiTestDeptService(ITestDeptService iTestDeptService) {
        System.out.println("属性注入");
        this.iTestDeptService = iTestDeptService;
    }

    @Override
    public void setBeanFactory(BeanFactory beanFactory) throws BeansException {
        System.out.println("BeanFactoryAware方法调用");
    }

    @Override
    public void setBeanName(String name) {
        System.out.println("BeanNameAware方法调用");
    }
    
    @Override
    public void afterPropertiesSet() throws Exception {
        System.out.println("InitializingBean调用");
    }

    @PostConstruct
    public void myInit() {
         System.out.println("PostConstruct注解方法");
     }

    @Override
    public void run(String... args) throws Exception {
        System.out.println("CommandLineRunner方法调用");
        for (int i = 0; i < args.length; i++) {
            System.out.println(i);
        }
    }

    @Override
    public void destroy() throws Exception {
        System.out.println("DisposableBean调用");
    }
}
